package packAutomatricula;

import java.awt.EventQueue;

import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.JButton;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

public class JDMatriculado extends JDialog {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private JLabel lblEnhorabuena;
	private JLabel lblEstasMat;
	private JButton btnSalir;
	

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					JDMatriculado dialog = new JDMatriculado();
					dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
					dialog.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the dialog.
	 */
	public JDMatriculado() {

		initialize();
	}
	private void initialize() {
		setModal(true);
		setBounds(100, 100, 276, 146);
		GroupLayout groupLayout = new GroupLayout(getContentPane());
		groupLayout.setHorizontalGroup(
			groupLayout.createParallelGroup(Alignment.LEADING)
				.addGroup(groupLayout.createSequentialGroup()
					.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
						.addGroup(groupLayout.createSequentialGroup()
							.addGap(85)
							.addComponent(getLblEnhorabuena()))
						.addGroup(groupLayout.createSequentialGroup()
							.addContainerGap()
							.addComponent(getLblEstasMat()))
						.addGroup(groupLayout.createSequentialGroup()
							.addGap(96)
							.addComponent(getBtnSalir())))
					.addContainerGap(14, Short.MAX_VALUE))
		);
		groupLayout.setVerticalGroup(
			groupLayout.createParallelGroup(Alignment.LEADING)
				.addGroup(groupLayout.createSequentialGroup()
					.addContainerGap()
					.addComponent(getLblEnhorabuena())
					.addPreferredGap(ComponentPlacement.RELATED)
					.addComponent(getLblEstasMat())
					.addPreferredGap(ComponentPlacement.RELATED, 11, Short.MAX_VALUE)
					.addComponent(getBtnSalir())
					.addContainerGap())
		);
		getContentPane().setLayout(groupLayout);
	}

	private JLabel getLblEnhorabuena() {
		if (lblEnhorabuena == null) {
			lblEnhorabuena = new JLabel("\u00A1Enhorabuena!");
		}
		return lblEnhorabuena;
	}
	private JLabel getLblEstasMat() {
		if (lblEstasMat == null) {
			lblEstasMat = new JLabel("Has sido matriculado satisfactoriamente.");
		}
		return lblEstasMat;
	}
	private JButton getBtnSalir() {
		if (btnSalir == null) {
			btnSalir = new JButton("Salir");
			btnSalir.addMouseListener(new MouseAdapter() {
				@Override
				public void mousePressed(MouseEvent arg0) {
					System.exit(0);
				
				}
			});
		}
		return btnSalir;
	}
}
